package com.hdd.biz.app.controller;

import com.hdd.biz.app.dto.AppResponse;
import com.hdd.biz.app.dto.PayRequest;
import com.hdd.biz.app.dto.WorksInfoRequest;
import com.hdd.biz.app.service.PayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/app/pay")
@Api(value = "小程序-微信支付",tags = {"小程序-微信支付"})
@Slf4j
public class PayController {

    @Autowired
    private PayService payService;

    @PostMapping("/rewardAuthorByWX")
    @ApiOperation(value = "微信打赏" ,notes = "")
    public AppResponse rewardAuthorByWX(@Valid @RequestBody PayRequest request ){
        return payService.rewardAuthorByWX(request);
    }

    @ApiOperation(value = "充值回调")
    @RequestMapping("/unifiedorderNotify")
    public String unifiedorderNotify(HttpServletRequest request){
        return payService.unifiedorderNotify(request);
    }

    @PostMapping("/rewardAuthorByBalance")
    @ApiOperation(value = "余额打赏" ,notes = "")
    public AppResponse rewardAuthorByBalance(@Valid @RequestBody PayRequest request ){
        return payService.rewardAuthorByBalance(request);
    }




}
